package com.mymoney;

import utils.Const;
import gui.support.TransDetailPagerAdapter;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageButton;

public class ReportGUI extends FragmentActivity {
	ViewPager mViewPager;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.report);
        
        TransDetailPagerAdapter adapter = new TransDetailPagerAdapter(getSupportFragmentManager());
        ViewPager myPager = (ViewPager) findViewById(R.id.transaction_view_pager);
        myPager.setAdapter(adapter);
        myPager.setCurrentItem(Const.BEGIN_POSITION, true);
        
        final ImageButton btnRpt = (ImageButton)findViewById(R.id.btnReport);
        final ImageButton btnSavings = (ImageButton)findViewById(R.id.btnSavings);
        final ImageButton btnSetting = (ImageButton)findViewById(R.id.btnSetting);
        
        btnRpt.setOnTouchListener(new OnTouchListener() {
			
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				v.setPressed(true);
				btnSavings.setPressed(false);
				btnSetting.setPressed(false);
				return true;
			}
		});
        
        
        btnSavings.setOnTouchListener(new OnTouchListener() {
			
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				v.setPressed(true);
				btnRpt.setPressed(false);
				btnSetting.setPressed(false);
				return true;
			}
		});
        
        
        btnSetting.setOnTouchListener(new OnTouchListener() {
			
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				v.setPressed(true);
				btnSavings.setPressed(false);
				btnRpt.setPressed(false);
				return true;
			}
		});
        
        //add transaction detail fragment
//        TransactionDetailFrag txDetailFrag = new TransactionDetailFrag();
//        txDetailFrag.setArguments(getIntent().getExtras());
//        
//        FragmentManager fragManager = getSupportFragmentManager();
//        FragmentTransaction fragTrans = fragManager.beginTransaction();
//        
//        fragTrans.setCustomAnimations(R., arg1)
//        
//        fragTrans.add(R.id.center, txDetailFrag).commit();
    }
    
    public void onReportClicked(View v) {
    	
    }
    
//    private boolean settingFlag = true;
//    public void onSettingClicked(View v) {
//    	if (settingFlag) {
//    		v.setBackgroundResource(R.drawable.btn_settings_select);
//    	}
//    	else {
//    		v.setBackgroundResource(R.drawable.btn_settings);
//    	}
//    	settingFlag = !settingFlag;
//    }
//    
//    private boolean savingFlag = true;
//    public void onSavingClicked(View v) {
//    	if (savingFlag) {
//    		v.setBackgroundResource(R.drawable.btn_savings_select);
//    	}
//    	else {
//    		v.setBackgroundResource(R.drawable.btn_savings);
//    	}
//    	savingFlag = !savingFlag;
//    }
//    
//    private boolean reportFlag = false;
//    public void onReportClicked(View v) {
//    	if (reportFlag) {
//    		v.set(R.drawable.btn_report_select);
//    	}
//    	else {
//    		v.setBackgroundResource(R.drawable.btn_report);
//    	}
//    	reportFlag = !reportFlag;
//    }
}
